package com.zhudi.develop_demo_as.ui.activity;

import android.content.Context;
import android.os.Bundle;

import com.zhudi.bean.DateTraffic;
import com.zhudi.develop.util.ZhudiDebugLog;
import com.zhudi.develop_demo_as.BaseActivity;
import com.zhudi.develop_demo_as.R;
import com.zhudi.develop_demo_as.db.FlowUtil;

import java.util.List;

public class DbActivity extends BaseActivity {
    private Context context;

    @Override
    protected int getLayoutView() {
        return R.layout.activity_db;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = this;
        initView();
    }

    private void initView(){
//        UserBean user = new UserBean();
//        user.setId("1");
//        user.setPhone("18758303254");
//        user.setProfile_picture("123");
//        user.setClient_id("1");
//        user.setName("朱笛");
//        user.setLocation("宁波市");
//        user.setGender("男");
//        //UserBeanDaoHelper.getInstance().insertOrUpdate(user);
//        //UserBeanDaoHelper.getInstance().addData(user);
//        MainApplication.getInstance().getDaoSession().getUserBeanDao().insertOrReplace(user);

//        Student student = new Student();
//        student.setStudentName("张三");
//        //student.setResults(123d);
//        MainApplication.getInstance().getDaoSession().getStudentDao().insertOrReplace(student);
//
//

//        List<UserBean> result1 = UserBeanDaoHelper.getInstance().getAllData();
//        for (UserBean bean : result1) {
//            ZhudiDebugLog.d(bean.getName());
//        }
//
        List<DateTraffic> result2 = FlowUtil.getInstance(context).getAllFlow();
        for (DateTraffic bean : result2) {
            ZhudiDebugLog.d(bean.getTraffic() + "");
        }
    }
}
